<template>
  <div>
    <!-- 搜索表单 -->
    <div style="margin-bottom: 20px">
      <el-input style="width: 240px" placeholder="请输入名称"></el-input>
      <el-input style="width: 240px; margin-left: 5px" placeholder="请输入联系方式"></el-input>
      <el-button style="margin-left: 5px" type="primary"><i class="el-icon-search"></i>搜索</el-button>
    </div>

    <div>
      <el-table :data="tableData" stripe>
        <el-table-column prop="id" label="用户ID"></el-table-column>
        <el-table-column prop="username" label="用户名"></el-table-column>
        <el-table-column prop="password" label="用户密码"></el-table-column>
        <el-table-column prop="is_deleted" label="逻辑删除（0-未删除，1-已删除）"></el-table-column>
        <el-table-column prop="created_at" label="创建时间"></el-table-column>
        <el-table-column prop="updated_at" label="更新时间"></el-table-column>
      </el-table>
      <!-- 分页 -->
      <div style="margin-top: 20px">
        <el-pagination
            background
            :page-size="10"
            layout="prev, pager, next"
            :total="tableData.length">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios';
export default {
  name: 'HomeView',
  data() {
    return {
      tableData: []
    }
  },
  created() {
  this.load()
  },
  methods: {
    load(){
      fetch('http://localhost:9090/user/list').then(res=>res.json()).then(res=>{
        console.log(res)
        this.tableData = res;
      })
        this.tableData = res;
    }
  }
}
</script>
